import request from '@/utils/request'

//路段列表
export function fetchList(query) {
  return request({
    url: '/road/list',
    method: 'post',
    data: query
  })
}

// 路段详情
export function roadDetail(id) {
  return request({
    url: '/road/' + id,
    method: 'get',
  })
}

// 创建路段
export function roadAdd(data) {
  return request({
    url: '/road/create',
    method: 'post',
    data
  })
}

// 更新路段
export function roadUpdate(data) {
  return request({
    url: '/road/update',
    method: 'post',
    data
  })
}

// 上线路段
export function roadSetOnline(id) {
  return request({
    url: `/road/setOnline/${id}`,
    method: 'post',
  })
}

// 下线路段
export function roadSetOffline(id) {
  return request({
    url: `/road/setOffline/${id}`,
    method: 'post',
  })
}

//根据机构获取路段列表
export function listRoad(departmentId) {
  return request({
    url: `/auth/listRoad/${departmentId}`,
    method: 'get',
  })
}